package cn.iocoder.yudao.module.dr.dal.mysql.collection3dacquisition;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.dr.controller.admin.collection3dacquisition.vo.Collection3dAcquisitionPageReqVO;
import cn.iocoder.yudao.module.dr.dal.dataobject.collection3dacquisition.Collection3dAcquisitionDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 藏品三维采集信息 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface Collection3dAcquisitionMapper extends BaseMapperX<Collection3dAcquisitionDO> {

    default PageResult<Collection3dAcquisitionDO> selectPage(Collection3dAcquisitionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<Collection3dAcquisitionDO>()
                .eqIfPresent(Collection3dAcquisitionDO::getCollectionId, reqVO.getCollectionId())
                .eqIfPresent(Collection3dAcquisitionDO::getGeneralAccessionNumber, reqVO.getGeneralAccessionNumber())
                .likeIfPresent(Collection3dAcquisitionDO::getCollectionName, reqVO.getCollectionName())
                .eqIfPresent(Collection3dAcquisitionDO::getCollectionNum, reqVO.getCollectionNum())
                .likeIfPresent(Collection3dAcquisitionDO::getResultName, reqVO.getResultName())
                .eqIfPresent(Collection3dAcquisitionDO::getFileFormat, reqVO.getFileFormat())
                .betweenIfPresent(Collection3dAcquisitionDO::getProcessingDate, reqVO.getProcessingDate())
                .eqIfPresent(Collection3dAcquisitionDO::getProcessingUnit, reqVO.getProcessingUnit())
                .eqIfPresent(Collection3dAcquisitionDO::getProcessor, reqVO.getProcessor())
                .eqIfPresent(Collection3dAcquisitionDO::getQualityInspector, reqVO.getQualityInspector())
                .eqIfPresent(Collection3dAcquisitionDO::getFileSize, reqVO.getFileSize())
                .eqIfPresent(Collection3dAcquisitionDO::getModelAccuracy, reqVO.getModelAccuracy())
                .eqIfPresent(Collection3dAcquisitionDO::getAvgPointSpacing, reqVO.getAvgPointSpacing())
                .eqIfPresent(Collection3dAcquisitionDO::getMaxPointSpacing, reqVO.getMaxPointSpacing())
                .eqIfPresent(Collection3dAcquisitionDO::getTextureResolution, reqVO.getTextureResolution())
                .eqIfPresent(Collection3dAcquisitionDO::getScanAcquisitionUnit, reqVO.getScanAcquisitionUnit())
                .eqIfPresent(Collection3dAcquisitionDO::getScanAcquisitionLocation, reqVO.getScanAcquisitionLocation())
                .betweenIfPresent(Collection3dAcquisitionDO::getScanAcquisitionDate, reqVO.getScanAcquisitionDate())
                .eqIfPresent(Collection3dAcquisitionDO::getScanAcquisitionPersonnel, reqVO.getScanAcquisitionPersonnel())
                .eqIfPresent(Collection3dAcquisitionDO::getScanEquipmentModel, reqVO.getScanEquipmentModel())
                .eqIfPresent(Collection3dAcquisitionDO::getScanFileFormat, reqVO.getScanFileFormat())
                .eqIfPresent(Collection3dAcquisitionDO::getScanModelAccuracy, reqVO.getScanModelAccuracy())
                .eqIfPresent(Collection3dAcquisitionDO::getScanAcquisitionInspector, reqVO.getScanAcquisitionInspector())
                .eqIfPresent(Collection3dAcquisitionDO::getPhotoAcquisitionUnit, reqVO.getPhotoAcquisitionUnit())
                .eqIfPresent(Collection3dAcquisitionDO::getPhotoAcquisitionLocation, reqVO.getPhotoAcquisitionLocation())
                .betweenIfPresent(Collection3dAcquisitionDO::getPhotoAcquisitionDate, reqVO.getPhotoAcquisitionDate())
                .eqIfPresent(Collection3dAcquisitionDO::getPhotoAcquisitionPersonnel, reqVO.getPhotoAcquisitionPersonnel())
                .eqIfPresent(Collection3dAcquisitionDO::getPhotoEquipmentModel, reqVO.getPhotoEquipmentModel())
                .eqIfPresent(Collection3dAcquisitionDO::getPhotoFileFormat, reqVO.getPhotoFileFormat())
                .eqIfPresent(Collection3dAcquisitionDO::getTotalImages, reqVO.getTotalImages())
                .eqIfPresent(Collection3dAcquisitionDO::getPhotoAcquisitionInspector, reqVO.getPhotoAcquisitionInspector())
                .eqIfPresent(Collection3dAcquisitionDO::getResolution, reqVO.getResolution())
                .betweenIfPresent(Collection3dAcquisitionDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(Collection3dAcquisitionDO::getSourceStatus,reqVO.getSourceStatus())
                .betweenIfPresent(Collection3dAcquisitionDO::getSubmitAuditDate,reqVO.getSubmitAuditDate())
                .betweenIfPresent(Collection3dAcquisitionDO::getCatalogDate,reqVO.getCatalogDate())
                .eqIfPresent(Collection3dAcquisitionDO::getCataloger,reqVO.getCataloger())
                .eqIfPresent(Collection3dAcquisitionDO::getAuditOpinion,reqVO.getAuditOpinion())

                .last("ORDER BY CONVERT(INTEGER, GENERAL_ACCESSION_NUMBER) ASC"));  // 达梦的 CONVERT 语法
    }

    public Collection3dAcquisitionDO selectByResultName(@Param("collectionId")Long collectionId, @Param("resultName")String resultName);

}